package com.deercrowing.takeaway.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.deercrowing.takeaway.entity.EmployeesEntity;
import com.deercrowing.takeaway.vo.EmployeesPageVO;
import com.deercrowing.takeaway.vo.EmployeesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * 员工信息(Employees)表数据库访问层
 *
 * @author guoyongxiang
 * @since 2024-07-05 17:25:35
 */
@Mapper
public interface EmployeesMapper extends BaseMapper<EmployeesEntity> {

    /**
     * 验证该用户是否存在
     *
     * @param username
     * @return
     */
    @Select("select * from tb_employees where username = #{username}")
    EmployeesVO getUserByUsername(String username);

    /**
     * 搜索所有用户
     *
     * @return
     */
    @Select("select * from tb_employees")
    List<EmployeesEntity> seleteList();

    /**
     * 变更用户启用\禁用状态
     *
     * @param status
     * @param id
     */
    @Update("update tb_employees set status = #{status} where id = #{id}")
    void updateByStatus(Short status, Integer id);

    /**
     * 根据搜索条件搜索用户
     *
     * @param employeePageVO
     * @return
     */
    List<EmployeesEntity> selectListByCondition(EmployeesPageVO employeePageVO);

    /**
     * 统计用户数量
     *
     * @param employeePageVO
     * @return
     */
    Integer countEmployeesNum(EmployeesPageVO employeePageVO);
}

